﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

// Reviewed
#pragma once
#include "GcmpGuiMainFrameInterface.h"
#include "OwnerPtr.h"

#include <string>
#include <vector>

namespace gcmp
{
    class IControl;
    class ICommandButtonDefinition;
    class ICheckBoxGroupDefinition;
    class IRadioButtonGroupDefinition;
    class IComboBoxDefinition;
    class ILineEditDefinition;
    class ICommandButtonMenuDefinition;
    class IGalleryDefinition;
    class IGroupHandler;
    class IRibbonToolBarControl;

    /// \brief group接口
    FINAL_INTERFACE class GCMP_GUI_MAIN_FRAME_INTERFACE_EXPORT IRibbonGroup
    {
    public:
        /// \brief 析构函数
        virtual ~IRibbonGroup();

        /// \brief 创建group对象
        ///
        /// \param groupId       group的Id,设置的唯一标识
        /// \param caption    group显示文字
        /// \return 创建出group对象。失败时返回空指针
        static OwnerPtr<IRibbonGroup> Create(const std::wstring& groupId, const std::wstring& caption);
     
        /// \brief 添加button至最后
        ///
        /// \param pButtonDefinition    ICommandButtonDefinition对象
        /// \return IControl对象，添加时会判断pButtonDefinition是否添加过，添加过会失败，失败时返回空指针
        virtual IControl* AddButton(OwnerPtr<ICommandButtonDefinition> pButtonDefinition) = 0;

        /// \brief 插入button
        ///
        /// 插入Id为beforeControlDefinitionId的controlDefinition对应控件的前面
        /// \param beforeControlDefinitionId    被插入的controlDefinition的id
        /// \param pButtonDefinition    将插入的ICommandButtonDefinition对象
        /// \return  IControl对象，插入时会判断pButtonDefinition是否添加过，添加过会失败，失败时返回空
        virtual IControl* InsertButton(const std::wstring& beforeControlDefinitionId, OwnerPtr<ICommandButtonDefinition> pButtonDefinition) = 0;

        /// \brief 添加lineEdit至最后
        ///
        /// \param pLineEditDefinition    ILineEditDefinition对象
        /// \return  IControl对象，添加时会判断pLineEditDefinition是否添加过，添加过会失败,失败时返回空指针
        virtual IControl* AddLineEdit(OwnerPtr<ILineEditDefinition> pLineEditDefinition) = 0;

        /// \brief 插入lineEdit
        ///
        /// 插入Id为beforeControlDefinitionId的controlDefinition对应控件的前面
        /// \param beforeControlDefinitionId    被插入的controlDefinition的id
        /// \param pLineEditDefinition    ILineEditDefinition对象
        /// \return   IControl对象，插入时会判断pLineEditDefinition是否添加过，添加过会失败，失败时返回空
        virtual IControl* InsertLineEdit(const std::wstring& beforeControlDefinitionId, OwnerPtr<ILineEditDefinition> pLineEditDefinition) = 0;

        /// \brief 添加comboBox至最后
        ///
        /// \param pComboBoxDefinition    IComboBoxDefinition对象
        /// \return  IControl对象，添加时会判断pComboBoxDefinition是否添加过，添加过会失败,失败时返回空指针
        virtual IControl* AddComboBox(OwnerPtr<IComboBoxDefinition> pComboBoxDefinition) = 0;

        /// \brief 插入comboBox
        ///
        /// 插入Id为beforeControlDefinitionId的controlDefinition对应控件的前面
        /// \param beforeControlDefinitionId    被插入的controlDefinition的id
        /// \param pComboBoxDefinition    将插入的IComboBoxDefinition对象
        /// \return  IControl对象，插入时会判断pComboBoxDefinition是否添加过，添加过会失败，失败时返回空指针
        virtual IControl* InsertComboBox(const std::wstring& beforeControlDefinitionId, OwnerPtr<IComboBoxDefinition> pComboBoxDefinition) = 0;

        /// \brief 添加Gallery至最后
        /// 
        /// \param pGalleryDefinition    IGalleryDefinition对象
        /// \return  IControl对象，添加时会判断pGalleryDefinition是否添加过，添加过会失败，失败时返回空指针
        virtual IControl* AddGallery(OwnerPtr<IGalleryDefinition> pGalleryDefinition) = 0;

        /// \brief 插入gallery
        ///
        /// 插入Id为beforeControlDefinitionId的controlDefinition对应控件的前面
        /// \param beforeControlDefinitionId    被插入的controlDefinition的id
        /// \param pGalleryDefinition    将插入的IGalleryDefinition对象
        /// \return  IControl对象，插入时会判断pGalleryDefinition是否添加过，添加过会失败,失败时返回空指针
        virtual IControl* InsertGallery(const std::wstring& beforeControlDefinitionId, OwnerPtr<IGalleryDefinition> pGalleryDefinition) = 0;

        /// \brief 添加buttonMenu至最后
        /// 
        /// \param pButtonMenuDefinition    ICommandButtonMenuDefinition对象
        /// \return  IControl对象，添加时会判断pButtonMenuDefinition是否添加过，添加过会失败，失败时返回空
        virtual IControl* AddButtonMenu(OwnerPtr<ICommandButtonMenuDefinition> pButtonMenuDefinition) = 0;

        /// \brief 插入buttonMenu
        ///
        /// 插入Id为beforeControlDefinitionId的controlDefinition对应控件的前面
        /// \param beforeControlDefinitionId    被插入的controlDefinition的id
        /// \param pButtonMenuDefinition    将插入的ICommandButtonMenuDefinition对象
        /// \return   IControl对象，插入时会判断pButtonMenuDefinition是否添加过，添加过会失败,失败时返回空指针
        virtual IControl* InsertButtonMenu(const std::wstring& beforeControlDefinitionId, OwnerPtr<ICommandButtonMenuDefinition> pButtonMenuDefinition) = 0;
     
        /// \brief 添加checkBoxGroup至最后
        ///
        /// \param pCheckBoxGroupDefinition    ICheckBoxGroupDefinition对象
        /// \return   IControl对象，添加时会判断pCheckBoxGroupDefinition是否添加过，添加过会失败，失败时返回空
        virtual IControl* AddCheckBoxGroup(OwnerPtr<ICheckBoxGroupDefinition> pCheckBoxGroupDefinition) = 0;

        /// \brief 添加RibbonToolBar到Group
        /// 
        /// \param  pRibbonToolBarControl    RibbonToolBarControl对象
        /// \return IRibbonToolBarControl对象，添加失败则返回为空
        virtual IRibbonToolBarControl* AddToolBar(OwnerPtr<IRibbonToolBarControl> pRibbonToolBarControl) = 0;
        /// \brief 插入checkBoxGroup
        ///
        /// 插入Id为beforeControlDefinitionId的controlDefinition对应控件的前面
        /// \param beforeControlDefinitionId    被插入的controlDefinition的id
        /// \param pCheckBoxGroupDefinition    将插入的ICheckBoxGroupDefinition对象
        /// \return IControl对象，插入时会判断pCheckBoxGroupDefinition是否添加过，添加过会失败,失败时返回空指针
        virtual IControl* InsertCheckBoxGroup(const std::wstring& beforeControlDefinitionId, OwnerPtr<ICheckBoxGroupDefinition> pCheckBoxGroupDefinition) = 0;

        /// \brief 添加radioButtonGroup至最后
        /// 
        /// \param pRadioButtonGroupDefinition    IRadioButtonGroupDefinition对象
        /// \return  IControl对象，添加时会判断pRadioButtonGroupDefinition是否添加过，添加过会失败，失败时返回空
        virtual IControl* AddRadioButtonGroup(OwnerPtr<IRadioButtonGroupDefinition> pRadioButtonGroupDefinition) = 0;
  
        /// \brief 插入radioButtonGroup
        ///
        /// 插入Id为beforeControlDefinitionId的controlDefinition对应控件的前面
        /// \param beforeControlDefinitionId    被插入的controlDefinition的id
        /// \param pRadioButtonGroupDefinition    IRadioButtonGroupDefinition对象
        /// \return   IControl对象，插入时会判断pRadioButtonGroupDefinition是否添加过，添加过会失败，失败时返回空指针
        virtual IControl* InsertRadioButtonGroup(const std::wstring& beforeControlDefinitionId, OwnerPtr<IRadioButtonGroupDefinition> pRadioButtonGroupDefinition) = 0;
      
        /// \brief 删除控件
        ///
        /// \param controlDefinitionId    控件数据定义的Id
        /// \return true表示成功， group中没有控件数据定义的Id为controlDefinitionId的控件,则返回false 
        virtual bool DeleteControl(const std::wstring& controlDefinitionId) = 0;

        /// \brief 删除所有控件  
        ///
        /// \return 
        virtual bool DeleteAllControl() = 0; 
  
        /// \brief 根据数据定义的id找控件对象pLabelDefinition
        ///
        /// \param controlDefinitionId    控件数据定义的Id
        /// \return  控件对象，group中没有控件数据定义的Id为controlDefinitionId的控件返回空指针
        virtual IControl* GetControl(const std::wstring& controlDefinitionId) const = 0;

        /// \brief 得到该group上所有控件
        ///
        /// \return  控件集合
        virtual std::vector<IControl*> GetAllControls() const = 0;      

        /// \brief 得到该group上所有RibbonToolBar
        ///
        /// \return  RibbonToolBar的集合
        virtual std::vector<IRibbonToolBarControl*> GetAllRibbonToolBar() const = 0;

        /// \brief 得到group的Id
        ///
        /// \return
        virtual std::wstring GetGroupId() const = 0;

        /// \brief 得到group上显示的文字
        ///
        /// \return
        virtual std::wstring GetCaption() const = 0;

        /// \brief 设置group的可见状态
        ///
        /// \param opGroupHandler group控制对象
        /// \return     true表示成功，false表示失败
        virtual bool SetGroupHandler(OwnerPtr<IGroupHandler> opGroupHandler) = 0;

        /// \brief 得到group的可见性
        ///
        /// group的状态由opGroupHandler控制，其返回不可见时，group不可见；其返回可见时，group下所有子控件不可见时，group也不可见，否则可见
        /// \return  返回true表示可见，返回false表示不可见
        virtual bool IsVisible() const = 0;

    };
}

